import VueRouter from 'vue-router'
import Vue from 'vue'
import loginPage from "@/views/loginPage.vue";
import adminLoginPage from "@/views/AdminLoginPage.vue";
import homePage from "@/views/homePage.vue";
import test from "@/views/testPage.vue";
import indexPage from "@/views/indexPage.vue";
import coursePage from "@/views/coursePage.vue";
import practice from "@/components/coursePage/courseChapter.vue";
import memoryPage from "@/views/memoryPage.vue";
import questionStructure from "@/components/coursePage/questionStructure.vue";
import teacherPage from "@/views/teacherPage.vue";
import adminPage from "@/views/adminPage.vue";
import adminIndexPage from "@/components/adminPage/adminIndexPage.vue";
import questionTypeManage from "@/components/adminPage/questionTypeManage.vue";
import studentManage from "@/components/adminPage/studentManage.vue";
import teacherManage from "@/components/adminPage/teacherManage.vue";
Vue.use(VueRouter)


const router = new VueRouter({
    routes: [
        {
            path: '/', redirect: '/studentPage'
        },
        { path: '/studentPage', component: indexPage,
          children:[
              {path: '/studentPage', redirect: '/studentPage/myCourses'},
              {path:'/studentPage/myCourses',component: () => import("@/components/studentPage/myCourses.vue") },
              {path:'/studentPage/modify-pwd/:studentId', component:() => import("@/components/personalCenter/modify-pwd.vue") },
              { path: '/studentPage/modify-email/:studentId', component: () => import('@/components/personalCenter/modify-email.vue') },
              { path: '/studentPage/modify-avatar/:studentId', component: () => import('@/components/personalCenter/modify-avatar.vue') }
          ]
        },
        { path: '/courses/:courseId', component: coursePage,
            children:[
                {path: '/courses/:courseId', redirect: '/courses/:courseId/practice'},
                {path:'/courses/:courseId/practice/',component: practice},
                {path:'/courses/:courseId/chapterInfo',component: questionStructure},
                {path:'/courses/:courseId/memoryInfo',component: questionStructure},
                {path:'/courses/:courseId/myMistakeQuestion', component: () => import ('@/components/coursePage/myMistakeQuestion.vue')},
                {path:'/courses/:courseId/myCollection', component: () => import ('@/components/coursePage/myCollection.vue')},
            ]
        },
        { path: '/home', component: homePage},
        { path: '/login', component: loginPage},
        { path: '/adminLogin', component: adminLoginPage},
        { path: '/teacherPage', component: teacherPage,
            children:[
                {path: '/teacherPage', redirect: '/teacherPage/teacherIndexPage'},
                {path: '/teacherPage/teacherIndexPage', component: () => import('@/components/teacherPage/teacherIndexPage.vue')},
                {path: '/teacherPage/courseManage', component:() => import('@/components/teacherPage/courseManage.vue')},
                {path: '/teacherPage/customQuestionType', component:() => import('@/components/teacherPage/customQuestionType.vue')},
                {path: '/teacherPage/chapterManage', component:() => import('@/components/teacherPage/chapterManage.vue')},
                { path: '/teacherPage/modify-pwd', component: () => import('@/components/personalCenter/modify-pwd.vue') },
                { path: '/teacherPage/modify-email', component: () => import('@/components/personalCenter/modify-email.vue') },
                { path: '/teacherPage/modify-avatar', component: () => import('@/components/personalCenter/modify-avatar.vue') }
            ]
        },
        { path: '/adminPage', component: adminPage,
            children:[
                {path: '/adminPage', redirect: '/adminPage/adminIndexPage'},
                {path: '/adminPage/adminIndexPage', component: adminIndexPage},
                {path: '/adminPage/courseReview', component:() => import('@/components/adminPage/courseReview.vue')},
                {path: '/adminPage/questionTypeManage', component: questionTypeManage},
                {path: '/adminPage/studentManage', component: studentManage},
                {path: '/adminPage/teacherManage', component: teacherManage},
                {path: '/adminPage/studentReview', component:() => import('@/components/adminPage/studentReview.vue') },
                { path: '/adminPage/modify-pwd', component: () => import('@/components/personalCenter/modify-pwd.vue') },
                { path: '/adminPage/modify-email', component: () => import('@/components/personalCenter/modify-email.vue') },
                { path: '/adminPage/modify-avatar', component: () => import('@/components/personalCenter/modify-avatar.vue') }
            ]
        },
        { path: '/home', component: homePage },
        { path: '/test/:courseId/:chapterId', component: test },
        { path: '/testResult',  component: () => import('@/views/testResult.vue') },

        { path: '/memory/:courseId', component: memoryPage },
        { path: '/onlineUsers', component: () => import('@/views/onlineUsers.vue') },
    ]
})


export default router
